var o,
  t = require("../../res/www.a9a.cn.js"),
  a = getApp();
Page({
  data: {
    more_height: "330rpx",
    morebtn_ico: "展开更多特权 ",
    morebtn_onoff: "off",
  },
  moreFn: function (o) {
    "off" == this.data.morebtn_onoff
      ? this.setData({
          morebtn_onoff: "on",
          morebtn_ico: "收起 ",
          more_height: "auto",
        })
      : this.setData({
          morebtn_onoff: "off",
          morebtn_ico: "展开更多特权 ",
          more_height: "330rpx",
        });
  },
  onLoad: function () {
    var e = this;
    a.get_openid().then(function (n) {
      e.setData({ color: a._ZEAI.color, rgbcolor: t.c16_rgb(a._ZEAI.color) }),
        a.chklogin().then(function (t) {
          t
            ? ((o = wx.getStorageSync("COOK_U")),
              a.ajax({
                url: "my.php",
                data: { submitok: "my_vip", openid: o.openid },
                success: function (o) {
                  1 == o.flag
                    ? 1 != o.ios_ifpay.flag
                      ? wx.getSystemInfo({
                          success: function (t) {
                            "ios" == t.platform
                              ? wx.showModal({
                                  title: "温馨提示",
                                  content: o.ios_ifpay.tips,
                                  confirmColor: e.data.color,
                                  cancelText: "返回",
                                  confirmText: "联系服务人员",
                                  success: function (o) {
                                    o.confirm
                                      ? wx.redirectTo({
                                          url: "../my/hongniang",
                                        })
                                      : o.cancel && wx.navigateBack();
                                  },
                                })
                              : e.setData({
                                  VIP: o.VIP,
                                  def_grade: o.def_grade,
                                  cook_grade_title: o.cook_grade_title,
                                  ios_ifpay: o.ios_ifpay,
                                });
                          },
                        })
                      : e.setData({
                          VIP: o.VIP,
                          def_grade: o.def_grade,
                          cook_grade_title: o.cook_grade_title,
                          ios_ifpay: o.ios_ifpay,
                        })
                    : "noreg" == o.flag
                    ? wx.navigateTo({ url: "../reg/reg" })
                    : wx.showModal({
                        title: "",
                        content: o.msg,
                        confirmColor: e.data.color,
                        cancelText: "返回",
                        confirmText: "联系服务人员",
                        success: function (o) {
                          o.confirm
                            ? wx.redirectTo({ url: "../my/hongniang" })
                            : o.cancel && wx.navigateBack();
                        },
                      });
                },
              }))
            : wx.redirectTo({ url: "../login/login" });
        });
    });
  },
  vipliFn: function (o) {
    var t = o.currentTarget.dataset.idx;
    this.setData({ def_grade: t });
  },
  payFn: function () {
    var o = this;
    1 != o.data.ios_ifpay.flag
      ? wx.getSystemInfo({
          success: function (t) {
            "ios" == t.platform
              ? wx.showModal({
                  title: "温馨提示",
                  content: o.data.ios_ifpay.tips,
                  confirmColor: o.data.color,
                  cancelText: "返回",
                  confirmText: "联系服务人员",
                  success: function (o) {
                    o.confirm
                      ? wx.redirectTo({ url: "../my/hongniang" })
                      : o.cancel && wx.navigateBack();
                  },
                })
              : a.pay({
                  data: { submitok: "my_vip", grade: o.data.def_grade },
                });
          },
        })
      : a.pay({ data: { submitok: "my_vip", grade: o.data.def_grade } });
  },
  payhnFn: function () {
    wx.navigateTo({ url: "../my/hongniang" });
  },
  ifagreeFn: function (o) {
    1 == o.detail.value
      ? this.setData({ ifagree: !0 })
      : this.setData({ ifagree: !1 });
  },
  ifagree_passFn: function () {
    wx.showToast({
      title: "请先点击同意《用户协议》和《隐私条款》",
      icon: "none",
      mask: !0,
      duration: 3e3,
    });
  },
});
